package jax.io;

/**
 * ...
 * @author tom
 */
class JOutputStream implements JCloseable {
	public var ntv:haxe.io.Output;
	public function new (?ntv:haxe.io.Output) {
		this.ntv = ntv;
	}
	public function write(b:Dynamic, ?off:haxe.Int32, ?len:haxe.Int32) {
		if(Std.is(b, Array))
			for(i in (off == null ? 0 : haxe.Int32.toInt(off))...(len == null ? b.length : haxe.Int32.toInt(len)))
				ntv.writeByte(b[i]);
		else
			ntv.writeByte(haxe.Int32.toInt(b));
	}
	public function flush() {
		ntv.flush();
	}
	public function close() {
		ntv.close();
	}
}
